# 自动化步骤
# 安装 selenium库
import time
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

# 创建驱动对象
driver = webdriver.Edge()
# 打开网页
driver.get("file:///D:/pagetest/注册A.html")

time.sleep(3)
# 创建鼠标操作对象
action = ActionChains(driver)
# ele = driver.find_element(By.CSS_SELECTOR,'#userA')

# 调用鼠标操作方法
# 单击
# action.click(ele)

# 双击
# ele.send_keys('admin')
# action.double_click(ele)

# 悬停
# a = driver.find_element(By.CSS_SELECTOR,'body > div.zc > fieldset > form > p:nth-child(5) > button')
# action.move_to_element(a)

# 电子邮箱输入123@qq.com
# a = driver.find_element(By.CSS_SELECTOR,'body > div.zc > fieldset > form > p:nth-child(4) > input')
# a.send_keys('123@qq.com')
# # 用鼠标选中所有内容
# action.double_click(a)
# action.click(a)
# 鼠标悬停菜单
a = driver.find_element(By.CSS_SELECTOR,'#item')
action.move_to_element(a)
# 点击打开淘宝
b = driver.find_element(By.CSS_SELECTOR,'#itemA')
action.click(b)
# 调用执行
action.perform()
# 关闭网页
time.sleep(123)






























